//
//  HTGuideView.m
//  HTDemo
//
//  Created by meet on 14-3-14.
//  Copyright (c) 2014年 HT. All rights reserved.
//

#import "HTGuideView.h"

@interface HTGuideView ()
@property (nonatomic, strong) NSMutableArray *panelArr;
@end

@implementation HTGuideView



- (NSMutableArray *)panelArr
{
    if(_panelArr == nil){
        
        _panelArr = [NSMutableArray array];
    }
    
    return _panelArr;
}

- (NSArray *)panelArrWithImageNames:(NSArray *)imageNames
{
    [self.panelArr removeAllObjects];
    
    for (int i = 0; i != imageNames.count; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageNames[i]]];
        UIImageView *panelView = [[UIImageView alloc] initWithImage:image];
//        panelView.contentMode = UIViewContentModeScaleAspectFit;
        panelView.frame = CGRectMake(Screen_Width*i, 0, Screen_Width, Screen_Height);
        [self.panelArr addObject:panelView];
    }
    
    return self.panelArr;
}



+ (id)guideViewWithImageNames:(NSArray *)imageNames
{
    HTGuideView *guideView = [[HTGuideView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, Screen_Height)];
    NSArray *panelArr = [guideView panelArrWithImageNames:imageNames];
    HTLogRect(guideView.frame);
    HTLogSize(guideView.contentSize);
    HTLog(@"%ld",(unsigned long)panelArr.count);
    guideView.contentSize = CGSizeMake(Screen_Width*panelArr.count, Screen_Height);
    guideView.backgroundColor = [UIColor clearColor];
    guideView.pagingEnabled = YES;
    guideView.showsHorizontalScrollIndicator = YES;
    
    for(int i = 0; i != panelArr.count; i++){
        
        [guideView addSubview:panelArr[i]];
    }
    return guideView;
    
}

- (NSInteger)numberOfPanel
{
    return self.panelArr.count;
}
@end
